<%@ taglib uri="/WEB-INF/myfaces_html.tld" 	prefix="h" %>
<%@ taglib uri="/WEB-INF/myfaces_core.tld" 	prefix="f" %>
<%@ taglib uri="/WEB-INF/tomahawk.tld"     	prefix="t" %>
<%@ taglib uri="/WEB-INF/myfaces_sandbox.tld"   prefix="s" %>

<f:view>
    <jsp:include page="/intestazione.jsp">
        <jsp:param name="titolo" value="Gestione Carta Regalo"/>
    </jsp:include>
    <jsp:include page="/menu.jsp"/>     
    <script language="javascript" src="./script/popup_full_center.js"></script>    
    <script language="javascript" src="./script/ripristinoSessione.js"></script> 

    <f:verbatim> <br/></f:verbatim> 

    <h:form binding="#{dettaglioCartaRegalo.form}">
        <t:panelTabbedPane serverSideTabSwitch="false">             

            <t:panelTab id="tab0" label="Dettaglio Carta">                               

                <t:saveState value="#{beanCartaRegalo}"/>
                <t:saveState value="#{beanCliente}"/>
                <f:verbatim> <br/></f:verbatim> 

                <f:verbatim> <table class="dettaglio">
                        <tbody>                      

                        <div class="storico">
                            <strong>CLIENTE: </f:verbatim> <h:outputText  value=" #{beanCliente.ragioneSociale}"/>
                            <f:verbatim> </strong>        
                        </div>
                        <tr>        
                            <td class="etichettaDettaglio"><strong></f:verbatim> <t:outputLabel for="codice" value="Codice"/><f:verbatim> </strong></td>
                            <td></f:verbatim> 
                            <t:inputText id="codice" value="#{beanCartaRegalo.codice}" size="20" maxlength="20" styleClass="dettaglio_InputText" style="text-align: right"  required="true" >
                            </t:inputText>
                            <f:verbatim> <br/></f:verbatim> <h:message style="color: red" for="codice" showDetail="true" showSummary="false" /><f:verbatim> 
                            </td>

                        </tr> 
                        <tr>        
                                <td class="etichettaDettaglio"><strong></f:verbatim> <t:outputLabel for="data" value="Data"/><f:verbatim> </strong></td>
                            <td></f:verbatim> <h:outputText value=" (gg/mm/aaaa)" style="font-size:6.5pt"/>
                            <f:verbatim> <br/></f:verbatim> 
                            <t:inputCalendar id="data" renderAsPopup="true" renderPopupButtonAsImage="true" popupDateFormat="dd/MM/yyyy" styleClass="campoTesto" required="true" value="#{beanCartaRegalo.data}">
                                <f:convertDateTime pattern="dd/MM/yyyy" type="both" timeZone="Europe/Rome"/>
                            </t:inputCalendar>
                            <h:message style="color: red" for="data" showDetail="true" showSummary="false" />
                            <f:verbatim> </td>
                        </tr> 



                        <tr>
                            <td class="etichettaDettaglio"><strong></f:verbatim> <t:outputLabel for="importo" value="Importo"/><f:verbatim> </strong></td>
                            <td></f:verbatim> <t:inputText id="importo" value="#{beanCartaRegalo.importo}" size="15" maxlength="15" styleClass="dettaglio_InputText" style="text-align: right"  required="true" >
                                <s:convertNumber minIntegerDigits="1" maxFractionDigits="2" pattern="#,##0.0" />
                            </t:inputText>
                            <f:verbatim> <br/></f:verbatim> <h:message style="color: red" for="importo" showDetail="true" showSummary="false" /><f:verbatim> 
                            </td>
                        </tr>

                        <tr>
                                <td class="etichettaDettaglio"><strong></f:verbatim> <t:outputLabel for="note" value="Note"/><f:verbatim> </strong></td>
                            <td colspan="5"></f:verbatim> <t:inputTextarea id="note" value="#{beanCartaRegalo.note}" rows="3" cols="100" required="false" styleClass="dettaglio_InputText"/><f:verbatim> </td>
                        </tr>

                    </table>
                </f:verbatim> 

                <f:verbatim> 
                    <table bgcolor="#FFFFFF" width="750px">
                        <tr>     
                            <td></f:verbatim> 
                            <h:commandLink styleClass="commandLink_Style" dir="RTL" action="benvenuto" immediate="true">
                                <t:graphicImage url="/image/go-home.png" border="0"/>
                            </h:commandLink>              
                            <f:verbatim> </td>   
                            <td></f:verbatim> 
                            <h:commandLink action="#{dettaglioCartaRegalo.primo}"  rendered="#{beanCartaRegalo.id ne null}" >
                                <t:graphicImage url="image/primo.png" border="0" title="Vai al primo elemento"/>
                                <f:param name="bean" value="beanCartaRegalo"/>                        
                                <f:param name="id" value="#{beanCartaRegalo.id}"/>                 
                            </h:commandLink>
                            <f:verbatim> </td>   
                            <td></f:verbatim> 
                            <h:commandLink action="#{dettaglioCartaRegalo.precedente}" rendered="#{beanCartaRegalo.id ne null}" >
                                <t:graphicImage url="image/indietro.png" border="0" title="Indietro"/>
                                <f:param name="bean" value="beanCartaRegalo"/>                        
                                <f:param name="id" value="#{beanCartaRegalo.id}"/>     
                            </h:commandLink>
                            <f:verbatim> </td>   
                            <td></f:verbatim> 
                            <h:commandLink action="#{dettaglioCartaRegalo.successivo}" rendered="#{beanCartaRegalo.id ne null}" >
                                <t:graphicImage url="image/avanti.png" border="0" title="Avanti"/>
                                <f:param name="bean" value="beanCartaRegalo"/>                        
                                <f:param name="id" value="#{beanCartaRegalo.id}"/>      
                            </h:commandLink>
                            <f:verbatim> </td>   
                            <td></f:verbatim> 
                            <h:commandLink action="#{dettaglioCartaRegalo.ultimo}" rendered="#{beanCartaRegalo.id ne null}" >
                                <t:graphicImage url="image/ultimo.png" border="0" title="Vai all'ultimo elemento"/>
                                <f:param name="bean" value="beanCartaRegalo"/>                        
                                <f:param name="id" value="#{beanCartaRegalo.id}"/>         
                            </h:commandLink>
                            <f:verbatim> </td>   
                            <td></f:verbatim> 
                            <h:commandLink  title="LISTA" id="lista" action="#{dettaglioCartaRegalo.lista}" rendered="#{beanCartaRegalo.id ne null}" >
                                <t:graphicImage url="image/lista.png" border="0" title="Carica lista" style="width:32px; height:32px"/>
                                <f:param name="bean" value="CartaRegalo" />
                            </h:commandLink>
                            <f:verbatim> </td>   
                            <td></f:verbatim> 
                            <h:commandLink  title="Torna Master" id="tornaMaster" action="#{dettaglioCartaRegalo.tornaMaster}" immediate="true">
                                <t:graphicImage url="image/undo.png" border="0" title="Torna Master"/>
                                <f:param name="beanPadre" value="beanCliente" />
                            </h:commandLink>
                            <f:verbatim> </td>   
                            <td></f:verbatim> 
                            <h:commandLink dir="RTL" onmousedown="return confirmDelete(this);" title="cancella" action="#{dettaglioCartaRegalo.cancella}" rendered="#{beanCartaRegalo.id ne null}" >
                                <t:graphicImage url="image/stop.png" border="0" title="Cancella"/>
                                <f:param name="bean" value="beanCartaRegalo" />
                                <f:param name="idPadre" value="#{beanCliente.id}"/>                                  
                            </h:commandLink>                
                            <f:verbatim> </td>   
                            <td></f:verbatim> 
                            <h:commandLink dir="RTL" onmousedown="return confirmUpdate(this);" title="modifica" action="#{dettaglioCartaRegalo.modifica}" rendered="#{beanCartaRegalo.id ne null}" >
                                <t:graphicImage url="image/salva.png" border="0" title="Salva modifiche"/>
                                <f:param name="bean" value="beanCartaRegalo" />
                                <f:param name="idPadre" value="#{beanCliente.id}"/>                                  
                            </h:commandLink>                
                            <f:verbatim> </td>   
                            <td></f:verbatim> 
                            <h:commandLink dir="RTL" onmousedown="return confirmSave(this);" title="salva inserimento" action="#{dettaglioCartaRegalo.inserisci}" rendered="#{beanCartaRegalo.id eq null}" >
                                <t:graphicImage url="image/salva.png" border="0" title="Salva inserimento"/>
                                <f:param name="bean" value="beanCartaRegalo" />
                                <f:param name="idPadre" value="#{beanCliente.id}"/>                 
                            </h:commandLink>                
                            <f:verbatim> </td>   
                            <td></f:verbatim> 
                            <h:commandLink dir="RTL" title="inserisce nuovo elemento" action="#{dettaglioCartaRegalo.inserisciDettaglio}" rendered="#{beanCartaRegalo.id ne null}" >
                                <t:graphicImage url="image/nuovo.png" border="0" title="Inserisci NUOVO"/>
                                <f:param name="bean" value="beanCartaRegalo" />
                            </h:commandLink>
                            <f:verbatim> </td>   
                            <td> 
                        </tr>
                    </table>
                </f:verbatim>
                <t:inputHidden value="#{beanCartaRegalo.id}"/>
            </t:panelTab>

            <t:panelTab id="tab1" label="Dettaglio Acquisti Carta">                               
                <f:verbatim> 
                    <table class="dettaglio">
                        <tbody>
                            <tr>
                                <td width="100px" style="font-size: 6.5pt" align="center">Data</td>
                                <td width="100px" style="font-size: 6.5pt" align="center">Importo</td>
                                <td width="100px" style="font-size: 6.5pt" align="center">Note</td>
                            </tr>
                        </f:verbatim> 

                        <t:dataList id="car" var="cartedet" value="#{dettaglioCartaRegalo.listaCarteDet}" 
                                    rowIndexVar="rigaR" style= "color: Black; font-family: Arial; font-size: 7pt; width: 99%;">                       
                            <f:verbatim> <tr></f:verbatim>
                                <f:verbatim><td width="100px">           </f:verbatim>
                                    <t:inputCalendar id="data" renderAsPopup="true" renderPopupButtonAsImage="true" popupDateFormat="dd/MM/yyyy" styleClass="campoTesto" required="false" value="#{cartedet.data}">
                                        <f:convertDateTime pattern="dd/MM/yyyy" type="both" timeZone="Europe/Rome"/>
                                    </t:inputCalendar>
                                    <h:message style="color: red" for="data" showDetail="true" showSummary="false" />            
                                    <f:verbatim></td>

                                    <td width="100px"> </f:verbatim>
                                    <t:inputText value="#{cartedet.importo}" > 
                                        <s:convertNumber pattern="#,##0.00###" />
                                    </t:inputText>
                                    <f:verbatim></td> 

                                    <td width="100px"></f:verbatim> 
                                    <t:inputText value="#{cartedet.note}" > 
                                    </t:inputText>
                                    <f:verbatim></td> 

                                    <td width="100px"></f:verbatim>
                                    <h:commandLink dir="RTL" title="cancella" action="#{dettaglioCartaRegalo.cancellaCartaDet}" rendered= "#{cartedet.id ne null}">
                                        <t:graphicImage url="/image/stop.png" border="0" width="20px"/>
                                        <f:param name="idDet" value="#{cartedet.id}" />                                                         
                                    </h:commandLink>

                                    <h:commandLink dir="RTL" title="modifica" action="#{dettaglioCartaRegalo.modificaCartaDet}" rendered= "#{cartedet.id ne null}">
                                        <t:graphicImage url="/image/salva.png" border="0" width="20px"/>
                                        <f:param name="idDet" value="#{cartedet.id}" />                                                         
                                    </h:commandLink>   

                                    <h:commandLink dir="RTL" title="inserisci" action="#{dettaglioCartaRegalo.inserisciCartaDet}" rendered= "#{cartedet.id eq null}">
                                        <t:graphicImage url="/image/nuovo.png" border="0" width="20px"/>
                                    </h:commandLink>    
                                    <f:verbatim></td>
                                </tr></f:verbatim>
                        </t:dataList>         

                        <f:verbatim> 
                        </tbody>
                    </table>
                    <br/>
                </f:verbatim> 
            </t:panelTab>
        </t:panelTabbedPane>             

    </h:form>   
    <h:form id="erroriDataBase" rendered="false">
        <f:verbatim><table><td align="left" class="messaggiErrore" height="2px"></f:verbatim>           
                <h:messages style="color: red" showDetail="true" showSummary="false"/>
                <f:verbatim></td></table></f:verbatim>
            </h:form>     

    <jsp:include page="/piePagina.jsp"/>      
</f:view>
